use crate::{
    pages::{home::Home, login::Login, not_found::NotFound},
    theme::ThemeManager,
};
use leptos::prelude::*;
use leptos_router::{
    components::{Route, Router, Routes},
    path,
};
use thaw::*;

#[component]
pub fn App() -> impl IntoView {
    let theme = ThemeManager::provide_theme();

    view! {
        <ConfigProvider theme>
            <ToasterProvider>
                <Router>
                    <Routes fallback=NotFound>
                        <Route path=path!("/home/*any") view=Home />
                        <Route path=path!("/login") view=Login />
                    </Routes>
                </Router>
            </ToasterProvider>
        </ConfigProvider>
    }
}
